/*
 * @(#)AgentHasComeAvailableListener.java
 *
 *
 *
 * ver 1.0 Sep 12, 2007 ggranum
 */
package org.testfire.realm.control.agent.event;

import java.util.Comparator;
import java.util.EventListener;

public abstract class AgentHasComeAvailableListener implements EventListener {

    public static final Comparator priorityComparator = new Comparator<AgentHasComeAvailableListener>(){
        public int compare(AgentHasComeAvailableListener o1, AgentHasComeAvailableListener o2) {
            return o1.priority - o2.priority;
        }
    };



    private int priority = 0;

    public AgentHasComeAvailableListener() {

    }

    /**
     * Notify a listener that an agent has come available.
     *
     * Any listener which chooses to utilize the now-available AgentEntity MUST call event.consume()!
     * @param event The event.
     */
    public abstract void agentHasComeAvailable(AgentAvailableEvent event);

    /**
     * Lower numbers are higher
     * @param priority - 
     */
    public final void setPriority(int priority){
        this.priority = priority;
    }

    public final int decreasePriority(){
        this.priority++;
        return this.priority;
    }

    public final int increasePriority(){
        if(this.priority != 0 )
            this.priority--;
        return this.priority;
    }

    public final int getPriority(){
        return this.priority;
    }



}

// eof: AgentHasComeAvailableListener.java